<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>货品信息列表</title>
<link href="<%=path%>/css/core.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/pagination.css" rel="stylesheet"
	type="text/css" />
<link href="<%=path%>/css/list.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/xToolbar.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/jquery-impromptu.css" rel="stylesheet"
	type="text/css" />
</head>

<body>
	<div id="toolbar"></div>
	<form id="listForm"
		action="<%=path%>/product/productionOrder/listPagination.t4m" method="post">
		<table id="titleTable" cellpadding="0" cellspacing="0">
			<tr>
				<td>&nbsp;</td>
              <td><input type="checkbox" id="allBox"/></td>
              <td>生产单编号</td>
              <td>生产时间</td>
              <td>申请人</td>
              <td>状态</td>
              <td>操作</td>
			</tr>
		</table>
		<table id="dataTable" cellpadding="0" cellspacing="0">
			<s:iterator id="object" value="page.list" status="i">
				<tr class="row" ondblclick="top.productionOrder.view('<s:property value="#object.id"/>')">
					<td class="num"><s:property value="#i.index+1" />
					</td>
                    <td class="box">
                     <s:if test="#object.auditState == 0">
                       <input type="checkbox" name="idList" value="<s:property value="#object.id"/>"/>
                     </s:if>
                    </td> 
                    <td><span><s:property value="#object.code" /> &nbsp;</span></td>
                    <td><span><s:date name="#object.productDate" format="yyyy-MM-dd"/>&nbsp;</span></td>
					<td><span><s:property value="#object.creator.realName" />&nbsp;</span></td>
                    <td>
                       <s:if test="#object.auditState == 0"><span>未审核&nbsp;</span></s:if>
                       <s:if test="#object.auditState == 1"><span>审核通过&nbsp;</span></s:if>
                       <s:if test="#object.auditState == 2"><span>审核未通过&nbsp;</span></s:if>
                    </td>
                    <td>
                    <s:if test="#object.auditState == 0 && #object.auditor.id == #session['LoginBean'].user.id ">
                        <a href="javascript:toCheck('<s:property value="#object.id" />',1);">审核通过</a>
                        &nbsp;&nbsp;
                        <a href="javascript:toCheck('<s:property value="#object.id" />',2);">审核驳回</a>
					</s:if>
                    </td>
				</tr>
			</s:iterator>
		</table>
	</form>

	<script src="<%=path%>/js/core.js" type="text/javascript"></script>
	<script src="<%=path%>/js/share.js" type="text/javascript"></script>
	<script src="<%=path%>/js/jquery.js" type="text/javascript"></script>
	<script src="<%=path%>/js/Grid.js" type="text/javascript"></script>
	<script src="<%=path%>/js/BoxSelect.js" type="text/javascript"></script>
	<script src="<%=path%>/js/xToolbar.js" type="text/javascript"></script>
	<script src="<%=path%>/js/xToolbar.items.js" type="text/javascript"></script>
	<script src="<%=path%>/js/jquery-impromptu.js" type="text/javascript"></script>
	<script type="text/javascript">
	$(document).ready(function(){
	      new Toolbar({
	          id: '1',
	          renderTo : 'toolbar',
	          icon: '../../image/op.gif',
	          items : [{
	                type : 'button',
	                text : '新建',
	                //useable : '<s:property value="@org.team4.util.Meta@getOperate(\"outOrder_edit\")"/>',
	                position: {
	                  a: '-20px 0px',
	                  b: '-20px -120px'
	                },
	                handler : function(){
	                	top.productionOrder.save();
	                }
	              },"-",{
	                type : 'button',
	                text : '修改',
	                //useable : '<s:property value="@org.team4.util.Meta@getOperate(\"outOrder_edit\")"/>',
	                position: {
	                  a: '-20px 0px',
	                  b: '-20px -120px'
	                },
	                handler : function(){
	                  if(getFirstID()) {
	                	  top.productionOrder.update(getFirstID());
	                  }
	                }
	              },"-",{
		                type : 'button',
		                text : '删除',
		                useable : '<s:property value="@org.team4.util.Meta@getOperate(\"outOrder_delete\")"/>',
		                position: {
		                  a: '-20px 0px',
		                  b: '-20px -120px'
		                },
		                handler : function(){
		  	        	  if(getFirstID()){
			                var txt = '是否删除该信息？';
			                $.prompt(txt,{
			                  buttons:{删除:true,取消:false},
			                  callback: function(v,m) {
			                    if(v) {
			                      window.location.href = '<%=path%>/product/productionOrder/delete.t4m?object.id=' + getFirstID();
			                    }
			                  }
			                });
			              }
		                }
		              }]
	        });
		
	      new Grid({
	        titleTable:'titleTable',
	        dataTable:'dataTable',
	        widths : [30,24,100,150,100,100,150],
	        height : function(){return getGridHeight({toolbarId:'toolbar',hasPage:true});}
	      });
	      
	      new BoxSelect({
	        allId : 'allBox',
	        boxName : 'idList'
	      });
	      
	      loadReady();
	    });
	function toCheck(id,auditState){
		var url = '<%=path%>/product/productionOrder/check.t4m?object.id=' + id + '&object.auditState=' + auditState;
		location.href = url;
	}
    </script>
</body>
</html>